package com.shop.loan.model.view;

import com.shop.loan.proxy.RentalPayBalanceLogProxy;
import lombok.Getter;
import lombok.Setter;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_erupt.Power;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.Readonly;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.*;
import xyz.erupt.jpa.model.BaseModel;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.math.BigDecimal;
import java.util.Date;

@Setter
@Getter
@Entity
@Table(name = "s_order_day_s")
@Erupt(
        name = "支付余额明细",
        orderBy = "id desc",
        dataProxy = RentalPayBalanceLogProxy.class,
        power = @Power(add = false, edit = false, viewDetails = false, delete = false)
)
public class RentalPayBalanceLog extends BaseModel {

    @Transient
    @EruptField(
            views = @View(title = "时间", width = "180px"),
            edit = @Edit(title = "时间",
                    readonly = @Readonly,
                    dateType = @DateType(type = DateType.Type.DATE_TIME))
    )
    private Date createTime;

    @Transient
    @EruptField(
            views = @View(title = "余额类型"),
            edit = @Edit(
                    title = "余额类型",
                    type = EditType.CHOICE,
                    notNull = true,
                    search = @Search,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(label = "小贷", value = "1"),
                                    @VL(label = "资管", value = "2"),
                                    @VL(label = "融担", value = "3"),
                            }
                    ))
    )
    private Integer type;

    @Transient
    @EruptField(
            views = @View(title = "用途"),
            edit = @Edit(
                    title = "用途",
                    type = EditType.CHOICE,
                    notNull = true,
                    search = @Search,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(label = "充值", value = "1"),
                                    @VL(label = "放款", value = "2"),
                                    @VL(label = "通道费", value = "3"),
                                    @VL(label = "还款", value = "4"),
                            }
                    ))
    )
    private Integer useType;

    @Transient
    @EruptField(
            views = @View(title = "方向", width = "150px"),
            edit = @Edit(
                    title = "方向",
                    type = EditType.BOOLEAN,
                    notNull = true,
                    boolType = @BoolType(
                            trueText = "+",
                            falseText = "-"
                    )
            )
    )
    private Boolean isAdd;

    @Transient
    @EruptField(
            views = @View(title = "金额", width = "150px")
    )
    private BigDecimal number;

    @Transient
    @EruptField(
            views = @View(title = "变更前余额", width = "150px")
    )
    private BigDecimal beforeMoney;

    @Transient
    @EruptField(
            views = @View(title = "变更后余额", width = "150px")
    )
    private BigDecimal afterMoney;



}
